Film and Video Quality Optimization Using Attention Mechanism-Embedded Lightweight Neural Network Model

In filming, the collected video may be blurred due to camera shake and object movement, causing the target edge to be unclear or deforming the targets. In order to solve these problems and deeply optimize the quality of movie videos, this work proposes a video deblurring (VD) algorithm based on neural network (NN) model and attention mechanism (AM). Based on the scale recurrent network, Haar planar wavelet transform (WT) is introduced to preprocess the video image and to deblur the video image in the wavelet domain. Additionally, the spatial and channel AMs are fused into the overall network framework to improve the feature expression ability. Further, the residual inception spatial-channel attention (RISCA) mechanism is introduced to extract the multiscale feature information from video images. Meanwhile, skip spatial-channel attention (SSCA) accelerates the network training time to achieve a better VD effect. Finally, relevant experiments are designed, factoring in peak signal-to-noise ratio (PSNR) and structural similarity (SSI). (e experimental findings corroborate that the proposed Haar and attention video deblurring (HAVD) outperformsmultisize networkHaar (MSNH) in PSNR and structural similarity (SSIM), improved by 0.10 dB and 0.005, respectively. (erefore, embedding the dual AMs can improve the model performance and optimize the video quality. (is work provides technical support for solving the video distortion problems.


Introduction
At present, video, as a widespread communication medium, plays a vital role in people's lives [1]. In particular, VD is one of the most widely pursued video quality optimization algorithms [2,3]. Li et al. employed deep learning (DL) to fuse multimodal medical images with excellent fusion effect, image detail clarity, and time efficiency [4]. e collected video data may be blurred, unclear, or deformed in real life due to camera shake or object motions, thus causing poor segmentation results [3]. For example, intelligent urban traffic management (UTM) can extract surveillance videos using a target segmentation algorithm [5]. It publicizes the personal information of the traffic rules violators on the street-erected electronic screen [6]. At the same time, moving pedestrians are often captured as blurred videos, affecting the video object segmentation and the subsequent warning effect. erefore, VD is critical as a preprocessing step for video object segmentation (VOS). e current VD research has problems, such as complex parameters, prolonged processing time, low precision, and unsatisfactory deblurring effect in real environments. Against these concerns, Lv et al. introduced collaborative computing to enhance computing performance and efficiency [7]. At present, constructing a lightweight, simple VD algorithm with high restoration and robust performance in the natural environment is an issue of urgency.
Over time, researchers first proposed a technique for estimating blur kernels and then adopted a deconvolution method regarding video quality optimization. However, experiments have shown that the quality of the estimated blur kernels will significantly affect the results and is not universal [8]. Recently, a new VD method has risen as a new technical solution. It uses a coarse-to-fine method to stack multiple Convolutional Neural Networks (CNNs) to analyze the blur formation to achieve a better deblurring effect. e multiscale loss function (LF) imitates the coarse-to-fine concept in traditional methods when training multiscale deblurring CNN and achieves good results [9]. However, there are still problems, such as poor restoration accuracy, excessive algorithm calculation, and long processing time for a single frame in VD. DL has long been applied to image quality optimization research. For example, Kim et al. proposed a DL bilinear model for image quality evaluation without reference [10]. Shen et al. constructed a significant end-to-end DL NN based on feature fusion in which a shared feature extractor was used to optimize both visual saliency prediction and image quality prediction [11].
Targeted at VD, this work proposes the Haar and Attention Video Deblurring (HAVD) method based on WT and AM. Innovatively, the proposed HAVD algorithm is introduced into the overall network framework to improve its feature expression ability. Finally, the inception structure is chosen to extract the video images' multiscale features. e SSCA module accelerates the network training time. After in-depth research, a movie and video image quality-oriented optimization method has been developed, which improves the video display quality, as well as the user viewing experience. e proposal enriches the content of video processing and provides technical support for the VD problem.

Relevant Theoretical Basis and Experimental Design
2.1. Neural Networks (NNs). NN, inspired by the neuron network in the human brain, imitates the neurons in the human brain through mathematically models and abstract algorithms with specific functions. Generally, it includes an input layer (that processes and judges the data), activation layer (increases the nonlinear structure of the network), and output layer (outputs the result). Sometimes, there are intermediate structures, such as hidden layers, depending on application scenarios. NN features strong self-adaptation and can quickly find the optimal solution; thus, it has broad research prospects [12,13]. Here, the proposed algorithm is completed based on the NN architecture, including the scale recurrent network (SRN), the one-shot video object segmentation (OSVOS) network, and the AM.

SRN.
e SRN adopts the symmetric encoding and decoding framework. e encoding process turns the input video image into a feature map with less space information and more channels. By comparison, the decoding process restores the original image size [14]. en, cascading networks of different sizes can better learn the information of video images of different scales. Doing so shares parameters and reduces the complexity and training difficulty of the network framework. e overall network structure of SRN is shown in Figure 1.
As from Figure 1, the video image is scaled up by upsampling and then cascaded to the next layer, going through a structure similar to the first-layer network framework. Finally, a clear video image is outputted. e encoding modules are composed of a convolutional layer combined with three residual error modules through the Rectified Linear Unit (ReLU) activation function (AF).
Similarly, the decoding module is connected by three residual error network units and a matrix transposed convolutional layer and finally outputs the signal through the ReLU. Each layer in the recursive cascade network inputs the image processed by the previous layers or the fixed image. Here, the layer-by-layer training method is abandoned, and the joint training method is adopted. e similarity between the distorted and fixed images is calculated only in the last layer. All the previous layers are updated by reverse propagation. In this way, each layer only needs to learn a simple deformation field, and desirable results can be achieved after all levels are connected.

OSVOS Network.
e OSVOS is a typical algorithm framework based on independent segmentation. It does not consider the timing relationship and processes each frame independently, preventing the information of the previous and subsequent frames from interfering with the current frame [15,16]. e specific structure is given in Figure 2. e algorithm is divided into three processes. e first step is to pretrain the ImageNet. e second step is to perform formal training on the relevant training set. Finally, the pregiven first frame mask is used for fine-tuning. e VOS is performed independently on a single frame for model testing [17]. e OSVOS algorithm uses the same processing method for all feature information. us, due to noise, illumination, and occlusion, OSVOS segments nontarget connected areas in the segmentation target, resulting in a decrease in the VOS quality. OSVOS is essentially still image segmentation without considering the temporal domain information of the video. In other words, a general foreground-background classification network is trained offline on a large data set. In the test stage, the network is fine-tuned for the given segmentation object to make it target the specified segmentation object.

AM.
e essential idea of the AM is detailed in Figure 3. e essential idea of AM reads (1) input a Key-Value pair. (2) By calculating the similarity between the Key and the Query, a series of weights can be obtained. e weights and values are weighted and summed to obtain the final mapping output. e specific process [18] is unfolded in (1). In (1), Sim and n represent the calculated similarity and the length of the key pair, respectively. rough the above operations, an AM mapping is updated.
AMs can be divided into temporal, channel, and spatial AM according to different domains [19]. is work focuses on spatial and channel AM, and the framework is portrayed in Figure 4. e specific operation of the channel and spatial AMs can be expressed by [20] where C, H, and W represent the number of channels, the feature map's height, and the feature map's width. First, Gp is used to average pool the feature map, compress it into R1 × 1 × C , and activate each layer's channel through two Afs: Fc1 and Fc2. Finally, the scale function F c3 multiplies with the original feature map F int to get the final output F CA . Channel AM assigns different weights to each region, focusing on the key regions through the above process.
After the feature map is average pooled and max pooled, two one-dimensional (1D) vectors can be obtained and pieced together to form a feature map with the C � 2 channels. e hidden layer contains a convolution kernel after the two-channel feature map is convolutioned. e generated 1D vector can correspond to the previous two-channel feature map to obtain the output result. en, the output result is multiplied with F CA mentioned above to get the final output F o . e specific operation can be represented by [21].
In (4), F avg and F max represent the average pooling and the maximum pooling. * and ⊗ are the convolution operation and the multiplication.
Spatial AM can weigh each output vector element differently to obtain a larger receptive field and information on the spatial domain [22].

Image Preprocessing Module.
is section introduces the two-dimensional (2D) WT based on multiscale network (MSN) for image preprocessing. e video image after Haar 2D WT and inverse transform is illustrated in Figure 5.
As in Figure 5(b), after the Haar 2D WT, a video image is subdivided into four components. e lowest frequency component is the upper left corner, closest to the original video image. e upper right denotes the high-frequency component, including the horizontal orientation information. By comparison, the lower-left corner is the high-frequency component, including the verticality-orientation detail. Lastly, the lower right corner is the highest frequency component, including the diagonal orientation detail information content. Inputting the four different subbands obtained above into the HAVD network can output the deblurred video images of the four subbands, as depicted in Figure 5    Here, a represents the input blurred video image. e original method is represented by a dotted arrow, which maps a to the output b through a function. However, the original method will lead to redundancy and generates certain noise. us, the 2D WT function g is introduced, as marked by the solid black arrow. en, g converts a into four wavelet domain subbands and maps to the output b' through the function f. Finally, a video image is restored through the inverse transformation g − 1 of g [23,24].
ere are two main advantages of the proposed image preprocessing method. On the one hand, the video image is sparse in the wavelet domain. Only fewer parameters can describe the video image, streamlining the network structure and reducing training complexity. On the other hand, the 2D WT can process the video image in the 2D wavelet domain, where the noise generally presents strong regional characteristics. us, it suppresses the noise and reconstructs more effective video images.

Spatial-Channel Dual AM-Embedded Module.
After the 2D WT preprocessing, the network architecture adds a spatial-channel attention block (SCAB) to increase the feature representation. SCAB consists of spatial AM and channel AM. By integrating the two AMs, different channels can use different weights, and the same channel can use different spatial positions. Different weights can improve the feature expression ability and the network performance [25][26][27]. e SCAB framework is unfolded in Figure 7.
Apparently, the upper branch of SCAB is spatial AM. F int (network input) passes through a convolution layer, acted by the ReLU. en, it passes through another convolution layer and its ReLU. Finally, F int passes the function corresponding to one convolutional layer and becomes Sigmoid. ereby, the spatial AM output is obtained. Multiplying the spatial AM output and the channel AM output yields the output F o of the SCAB module.
e SCAB flow can be expressed [28] by Here, F o represents the SCAB output. F int means the spatial AM input. F CA is the channel AM output, and ⊗ denotes the multiplication.

Residual Inception Spatial-Channel Dual AM Module.
e inception module can integrate features from differentsize filters, thereby increasing the width and depth of the overall network. Accordingly, a Residual Network (ResNet) is added to collect different features from the previous layer input to compensate for the network's insufficient spatiotemporal feature extraction ability. en, the network prediction accuracy can be improved through fine-tuning and quantization [29,30]. erefore, this section proposes the RISCA mechanism, and the module structure is signaled in Figure 8. e RISCA input is F i . e input F i passes through three different convolutional layers that will be cascaded. en, F i passes through a 1 × 1 convolutional layer and a SCAB module, and the output result is added to the input F i to obtain the final output F o . e whole process can be represented [31] by In (6), F i is the network input, and F o represents the RISCA module output. f 1×1 and f 3×3 stand for the convolutional layer with the 1 × 1 and 3 × 3 kernels, respectively. ⊙ denotes the cascade operation, and SCAB signifies the application function of the SCAB module.

Skip Spatial-Channel Attention (SSCA) Module.
SSCA embeds the spatial-channel AM modules into the skip-connection structure. e skip-connection module helps solve vanishing gradient descent, reducing training time and efficiency [32]. SSCA module connects the encoder-decoder network framework and performs nonlinear transformation, extracting feature maps under a suppressed noise [33]. e SSCA is manifested in Figure 9. e SSCA input (F i ) passes through four different modules.
ere are three convolutional layers with 3 × 3 kernels and a SCAB module from left to right. en, adding the output results and the input F i gets the final output s. Notably, the three convolutional layers have different functions. e first convolutional layer reduces the channels to 1/4 of the input. e second convolutional layer is the nonlinear transformation. e last convolutional layer e whole process can be written in (7) [34], where s represents the whole process.
Traditional VD algorithms usually use the L 2 norm LF to calculate the sum of squared error (SSE) between the target and the estimated objects, as counted by [35]: In (8), N is the sample number. V n denotes the clear video image, and V n * represents the output video image. Given that L 2 LF is less robust; this section introduces the perceptual loss to obtain better visual effects. In particular, perceptual loss can obtain each layer's feature map activation value [36], as estimated by In (9), W s,q × H s,q is the feature map size. φ s,qa,b represents the feature extraction by the bth convolution of the VGG (visual geometry group) 19 (pretrained on the ImageNet database) before the ath maximization layer. Finally, to obtain the boundary signal of the video image, an edge LF is introduced [37], as exhibited in In (10), ∇ x and ∇ y are the horizontal difference and the vertical difference. Integrating the above three LFs gets the L t used in this work [38], as computed in In (11), a, b, and c represent the weight coefficients of the LFs: L 2 , L p , and L e , respectively.

VD Process.
VD can make video images clearer, a typical computer vision (CV) and image processing (IP) problem [39], as charted in Figure 10.    In order to deblur images, Figure 10 inputs and segments the video and preprocesses the video frame through WT. en, it performs two pooling operations simultaneously. Afterward, it extracts multiscale information and concatenates the second and third layers' scale information to the first layer of video frames. Further, it fuses the features through the residual AM, connects the codec through the SSCA module, and reconstructs the image through RISA. Finally, the wavelet inverse transform is employed to output the video frame and get the final reconstruction result.

Experimental Analysis and Performance Evaluation.
e experiment selects two metrics: PSNR and SSIM, as the primary evaluation criteria. PSNR is measured by dB. e higher the score is, the better the VD effect is, and the higher the video image quality is.
Suppose the video image size is W × H, the original clear video image is S (x, y), and the video image output by the HAVD network is O (x, y). In that case, PSNR can be estimated by [40] PSNR � 10lg In (12), mean square error (MSE) is forecasted by (13) SIM ∈ [0, 1]. e higher the score is, the higher the similarity between the restored and original images is. e specific calculation reads [42] SSIM (s, o) � d(s, o) a e(s, o) b f(s, o) In equations (14)- (17), s represents the original image, and o is the video image output by the HAVD. g 1 , g 2 , and g 3 are constants, and μ is the calculation mean. σ means the calculated variance. Here, a, b, and c are parameters of importance. Equations (15)-(17) calculate the measured values of different modules. d, e, and f represent the measured brightness, measured contrast, and measured structure, respectively. SSIM stands for the structural similarity, as estimated by (14). Meanwhile, the SSIM operator should meet the basic properties as a measure.

Influence of Different Modules on Overall Model
Performance. In order to verify the performance of the proposed algorithm, this section comparatively analyses the influence of single-size network (SSN), MSN, and Multisize Network Haar (MSNH) on the HAVD model. e specific results are plotted in Figure 11. Figure 11 suggests that MSN is 0.13 dB and 0.002 higher in PSNR and SSIM than SSN. Presumably, the MSN can extract the features from images of different scales better than the SSN. rough three different scales, from coarse to fine, the parameters are shared and reflected in the output video image, improving the PSNR and optimizing image quality. On the other hand, compared with MSN, MSNH improves PSNR and SSIM by 0.19 dB and 0.003, respectively. Probably, the Haar WT can process the video image in the wavelet domain and suppress noise, thus reconstructing better video images. Finally, compared with MSNH, HAVD improves PSNR and SSIM by 0.10 dB and 0.005, respectively. e reasons are explained as follows. Firstly, adding double AM has increased the SSIM index by 0.005, more than the MSN improvement of 0.002 and the MSNH of 0.003. Meanwhile, embedding double AM can greatly improve the network framework's pertinence and reduce redundant Computational Intelligence and Neuroscience calculations. us, the PSNR is enhanced, and so is the video image quality.

Test Results on the GoPro Dataset.
Recently, GoPro has been the most widely used dataset in DL-based methods. Firstly, a clear video is captured by a high-speed camera, some frames are intercepted from the video as clear images, and the synthetic dataset is generated by mixing the front and back frames of the clear image. e GoPro dataset provides 2,103 and 1,111 pairs of blurred and clear images for its training and test sets, respectively. Figure 12 compares the results of the HAVD algorithm and other existing algorithms on the GoPro dataset. Figure 12 implies that the proposed HAVD algorithm is superior to other algorithms in PSNR and SSIM. Presumably, the HAVD algorithm shares a set of parameters for the three scales, simplifying the network architecture and improving the training effect. At the same time, HAVD embeds WT and AM to obtain a more reasonable network framework. To sum up, the proposed HAVD algorithm has more advantages than other algorithms in numerical quantitative indicators, with higher-quality image restoration.
Next, Figure 13 comparatively analyses the HAVD algorithm and the video restoration with enhanced deformable convolutional networks (EDVR) on the GoPro dataset. Scene 1 and Scene 2 in Figure 13 are selected from everyday scenes in life. Scene 1 is the house number image, and Scene 2 is the flower image. Figure 13 displays the visual comparison between the HAVD and EDVR on the GoPro dataset. en, the testing set selects two different scenes from the GoPro dataset for visual effect analysis. Specifically, Scene 1 is a household door, where the house number is set on a blue background. Figure 13(a) is the original video image: the left and right sides correspond to the VD image by EDVR and by HAVD, respectively. In Scene 2, Figure 13(c) is a blurred video image, where the edge of the flower is blurred seriously: the left and right sides are the VD image by EDVR and HAVD, respectively. Apparently, the VD image by the proposed HAVD has a clear outline, restored more realistically than by EDVR. To sum up, both experimental data and visual effects corroborate the proposed HAVD algorithm' better restoration effect over the other algorithm.   e CiaoDVD dataset contains 6m 708 blurred images. Compared with the GoPro dataset, it is more difficult to recover. Figure 14 compares the experimental results between the proposed HAVD and SRN algorithms. Figure 14 indicates that the HAVD recovers the video image with a 29.63 dB PSNR and a 0.920 SSIM. PSNR and SSIM of SRN are 29.33 dB and 0.912. Apparently, the proposed HAVD algorithm outperforms SRN by 0.30 dB and 0.008, respectively, in PSNR and SSIM. Although data processing is complex and the improvement of SSIM is slight on the CiaoDVD dataset, the PSNR is greatly improved by 0.30 dB. e finding verifies the feasibility of dual AM and WT preprocessing to improve the VD accuracy.

CiaoDVD
Further, the VD effects of HAVD and SRN on the CiaoDVD dataset are analyzed in Figure 15.
Here, two different scenes are selected to compare the VD effects. Scene 1 is a car on the road, focusing on the letters and numbers in the blue box. After SRN processes the blurred video image, the letters are partially missing. e blue frame is not restored well compared to the original blurred video image. In contrast, the proposed HAVD algorithm restores the edge contours better. e letters and numbers in the blue box are also clearly restored. In Scene 2, a sign on the road HAVD adopts a dual AM in the spatial and channel domains to remove the external interference. As a result, the proposed HAVD recognizes and restores the letter "EXIT." On the other hand, the SRN-based VD image Computational Intelligence and Neuroscience is still difficult for the human eye to recognize the letter "EXIT." To sum up, the proposed HAVD has a more explicit restoration effect on the CiaoDVD dataset than the SRN.

Conclusions
e research of the VD algorithm has some problems in the actual environment, such as complex parameters, long processing time, low precision, and unsatisfactory deblurring effect. is work proposes a HAVD algorithm based on WT and AM to solve these problems. Specifically, based on a multiscale recurrent network, HAAR-2D-WT is introduced to preprocess the image to deblur the video image in the wavelet domain. Meantime, spatial AM and channel AM are integrated into the overall network framework to improve the feature expression ability. en, the RISCA structure is employed to extract the multiscale video image features. SSCA module speeds up the model training to achieve a better VD effect. e algorithm is simulated and compared on two benchmark datasets and one self-built dataset. e numerical results show that the PSNR and SSIM of MSN are 0.13 db and 0.002 higher than those of SSN. MSN can extract different-sized features better than SSN.
rough three different scales, from coarse to fine, the parameters are shared and reflected in the output video image, thereby improving PSNR and optimizing image quality. e proposed HAVD algorithm is superior to other algorithms in PSNR and SSIM. HAVD algorithm shares a set of parameters on three scales, simplifying the network structure and improving the training effect. Meanwhile, the proposed HAVD algorithm is 0.30 db and 0.008 higher than SRN in PSNR and SSIM. Compared with SRN, the proposed HAVD has a more apparent recovery effect on the CiaoDVD dataset. us, the proposed HAVD algorithm shows better performance in PSNR and SSIM and can effectively optimize the video quality. e scheme has important application significance in other fields. However, there are still several problems in video quality optimization which need to be studied carefully. For example, multiple cameras shoot and collect videos from different angles in real life, and each camera processes them separately. In the future, deblurring and target segmentation from different angles and combined with video still need further research and improvement. It is expected to extend this work to dynamic video target detection.

Data Availability
e data used to support the findings of this study are included within the article.

Conflicts of Interest
e authors declare that they have no conflicts of interest.